home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / QuickTime / Programming Stuff / Documentation / develop articles / develop Issue 23 / Internet Config / ICEmailAddress / ICEmailAddress.p next >
Encoding:
Text File  |  1995-04-05  |  976 b   |  33 lines  |  [TEXT/PJMM]

  1. program ICEmailAddress;
  2.     (* The simplest IC aware program. It simply outputs *)
  3.     (* the user's preferred Email address. *)
  4.  
  5.     uses
  6.         ICTypes, ICAPI, ICKeys;    (* standard IC interfaces *)
  7.  
  8.     var
  9.         instance: ICInstance;
  10.                         (* opaque reference to IC session *)
  11.         str: Str255;
  12.                         (* buffer to read Email address into *)
  13.         str_size: longint;
  14.                         (* size of above buffer *)
  15.         junk: ICError;
  16.                         (* place to throw away error results *)
  17.         junk_attr: ICAttr;
  18.                     (* place to throw away attributes *)
  19. begin
  20.     (* start IC *)
  21.     if ICStart(instance, '????') = noErr then begin
  22.         (* specify a database, in this case the default one *)
  23.         if ICFindConfigFile(instance, 0, nil) = noErr then begin
  24.             (* read the real name preferences *)
  25.             str_size := sizeof(str);
  26.             if ICGetPref(instance, kICEmail, junk_attr, @str, str_size) = noErr then begin
  27.                 writeln(str);
  28.             end; (* if *)
  29.         end; (* if *)
  30.         (* shut down IC *)
  31.         junk := ICStop(instance);
  32.     end; (* if *)
  33. end. (* ICEmailAddress *)